HAL PWR migration: List of applicable concepts

This section provides information about the HAL PWR applicable architecture concepts.

Concepts for PWR

Concept

Description

HAL implementation with LL inline functions

HAL PWR APIs now rely on LL APIs rather than performing direct register access.

Removal of hardware-related macros in HAL2

All hardware macros have been removed from the HAL PWR driver, and equivalent services are ensured through the LL APIs.

Revised and optimized HAL API status returns

The HAL PWR functions were updated to return:

  • HAL_INVALID_PARAM: in case of a NULL p_config structure pointer.

  • HAL_ERROR: in case of an error.

  • HAL_OK: in case of a successfully completed operation.

Replaced TypeDef suffix with _t in type names

All TypeDef parts of the HAL PWR driver have been removed and replaced by _t.

Replaced multi-line macros with inline functions

For the HAL PWR driver, large macros have been replaced by inline functions to maintain code consistency, improve readability, and benefit from compiler optimization. Inline functions also offer better support for debugging and strict type management, reducing the risk of errors.

Replaced nonmodifiable pointers with const keywords

Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable.

Assertion implementation and usage in HAL1

There is no machine state for PWR. For the parameters, the check is performed using the ASSERT_DBG_PARAM macro.

Merge HAL extension files with common ones and remove the EX prefix from APIs.

Only one HAL PWR header file remains and all macros, define statements, and functions from hal_pwr_ex.h have been moved to hal_pwr.h.

Remove EXTI Intrinsic Management in System HAL Drivers; Let Users Rely on EXTI HAL Driver.

All EXTI intrinsic management in system services are removed and it will be managed through EXTI HAL driver .

Split Peripheral Configuration from Start in System HAL Drivers.

The EXTI driver configuration has been decoupled from the PWR driver. This means that the responsibility for configuring EXTI lines, which are often used as wakeup sources, is no longer handled within the PWR driver. Instead, the EXTI driver is now solely responsible for managing the configuration of external interrupts.

Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.

Finite parameters (including PWR instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety.

Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).

HAL PWR resources and data structure are started with HAL_PWR.

Other HAL PWR changes

Concept

Consideration

Remove De-Initialization API

No need to Init/DeInit APIs as the main power-related features like Voltage Scaling VOS and the internal voltage regulator are enabled and functional by default.

Consequently, explicit initialization or de-initialization by the user is not required.